import request from "../axios/index";

/*
 * 描述：查询角色
 * 参数data: object  {name: '角色名', status: '状态', createTime: '创建时间'}
 */
export function getRole(data) {
  return request({
    method: "post",
    url: "/api/manage/role/getRolePageByName",
    data: data,
  });
}

// 查询单个角色详情
export function getRoleDetail(id) {
  return request({
    method: "post",
    url: "/api/manage/role/selectRoleDetailById/" + id,
  });
}

// 删除角色
export function deleteRole(id) {
  return request({
    method: "post",
    url: "/api/manage/role/deleteRoleById/" + id,
  });
}

// 新增角色
export function addRole(data) {
  return request({
    method: "post",
    url: "/api/manage/role/saveRole",
    data,
  });
}

// 修改角色
export function updataRole(data) {
  return request({
    method: "post",
    url: "/api/manage/role/updateRole",
    data,
  });
}

// 获取所有关联资源
export function getAllResources() {
  return request({
    method: "get",
    url: "/api/manage/resource/getAll",
  });
}
